﻿using System;
using System.Collections.Generic;

namespace Storyteller.Framework.Graphics.Particles.EmitModifiers
{
	public class RandomColorListEmitModifier : ParticleEmitModifier
	{
		public List<Color> Colors { get; set; }

		public RandomColorListEmitModifier()
		{
			random = RandomUtil.Random;

			Colors = new List<Color>();
		}

		public override void Process(Particle[] particles, int offset, int count)
		{
			if(Colors.Count == 0)
				throw new Exception("No colors available in list");

			for (int i = 0; i < count; i++)
			{
				particles[i + offset].Color = Colors[random.Next(0, Colors.Count)];
			}
		}

		Random random;
	}
}
